/*************************************************************************** 
 * (c) 2006 Dmitry Osinovsky, osdmsoftware@gmail.com
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU Lesser General Public License as        *
 *   published by the Free Software Foundation; either version 2 of the    *
 *   License, or (at your option) any later version.                       *
 *                                                                         *
 ***************************************************************************/

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace OsdmSoftware.PocketPicture
{
    public partial class SizeForm: Form
    {
        int widthEdit;

        public int WidthEdit { get { return widthEdit; } set { widthEdit = value; widthBox.Text = widthEdit.ToString(); } }

        int heightEdit;

        public int HeightEdit { get { return heightEdit; } set { heightEdit = value; heightBox.Text = heightEdit.ToString(); } }

        public SizeForm()
        {
            InitializeComponent();
#if !PocketPC
            this.AcceptButton = button1;
            this.CancelButton = button2;
#endif

        }

        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                widthEdit = Int32.Parse(widthBox.Text);
                heightEdit = Int32.Parse(heightBox.Text);
            }
            catch
            {
                MessageBox.Show("Cannot convert to number");
                return;
            }

            if (widthEdit <= 0 || HeightEdit <= 0)
            {
                MessageBox.Show("Please enter positive nonzero numbers");
                return;
            }

            this.DialogResult = DialogResult.OK;
        }
    }
}